﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcs.Web.inspectioninfos
{
    public partial class Add : Web.Admin.BasePage
    {
        public string strid = "";
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
            if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
            {
                strid = Request.Params["id"];
                int out_storage_detail_Id = 0;
                int.TryParse(strid,out out_storage_detail_Id);
                int inspectioninfo = 0;
                int submitUid = getid();
                int? inspection_id = null;
                if (ddlinspectioninfo.SelectedValue == "1")
                { 
                    inspectioninfo = 1;
                    lcs.Model.inspectionMaterial modelm = new lcs.Model.inspectionMaterial();
                    modelm.submitUid = submitUid;
                    modelm.out_storage_detail_Id = out_storage_detail_Id;
                    modelm.submitQuestion = txtsubmitQuestion.Text;
                    modelm.submitTime = DateTime.Now;
                    modelm.checkUid = null;
                    lcs.BLL.inspectionMaterial bllm = new lcs.BLL.inspectionMaterial();
                    inspection_id=bllm.AddE(modelm);
                }
                
                lcs.Model.inspectioninfos model = new lcs.Model.inspectioninfos();
                model.submitUid = submitUid;
                model.out_storage_detail_Id = out_storage_detail_Id;
                model.inspectioninfo = inspectioninfo;
                model.submitTime = DateTime.Now;
                model.inspection_id = inspection_id;

                lcs.BLL.inspectioninfos bll = new lcs.BLL.inspectioninfos();
                bll.Add(model);
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "list.aspx?id="+ strid);
            }

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }

        protected void ddlinspectioninfo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlinspectioninfo.SelectedValue == "1")
                Panel1.Visible = true;
            else
                Panel1.Visible = false;
        }
    }
}
